package com.mobile.collect.beans;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.List;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import com.mobile.collect.db.DaoSession;
import com.mobile.collect.db.ExportPicInfoDao;
import com.mobile.collect.db.ExportResultInfoDao;

/**
 * 类名: UploadDeviceInfo
 * 作者: 李学伟
 * 日期: 2020年09月30日 11:42
 * 描述:
 */
@Entity
public class ExportResultInfo {
    @Id
    private Long _ID;
    private String deviceName;
    private String deviceNum;
    private String devicePic;
    private Long parentId;
    private String exportTime;
    private boolean hadUploaded;

    @ToMany(referencedJoinProperty = "parentId")
    private List<ExportPicInfo> picPathList;
    private String excelPath;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 111908339)
    private transient ExportResultInfoDao myDao;

    @Generated(hash = 1444963071)
    public ExportResultInfo(Long _ID, String deviceName, String deviceNum, String devicePic,
            Long parentId, String exportTime, boolean hadUploaded, String excelPath) {
        this._ID = _ID;
        this.deviceName = deviceName;
        this.deviceNum = deviceNum;
        this.devicePic = devicePic;
        this.parentId = parentId;
        this.exportTime = exportTime;
        this.hadUploaded = hadUploaded;
        this.excelPath = excelPath;
    }

    @Generated(hash = 1633862680)
    public ExportResultInfo() {
    }

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public String getDevicePic() {
        return devicePic;
    }

    public void setDevicePic(String devicePic) {
        this.devicePic = devicePic;
    }


    public void setPicPathList(List<ExportPicInfo> picPathList) {
        this.picPathList = picPathList;
    }

    public String getExcelPath() {
        return excelPath;
    }

    public void setExcelPath(String excelPath) {
        this.excelPath = excelPath;
    }

    public Long get_ID() {
        return this._ID;
    }

    public void set_ID(Long _ID) {
        this._ID = _ID;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1287235697)
    public List<ExportPicInfo> getPicPathList() {
        if (picPathList == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ExportPicInfoDao targetDao = daoSession.getExportPicInfoDao();
            List<ExportPicInfo> picPathListNew = targetDao
                    ._queryExportResultInfo_PicPathList(_ID);
            synchronized (this) {
                if (picPathList == null) {
                    picPathList = picPathListNew;
                }
            }
        }
        return picPathList;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 946767635)
    public synchronized void resetPicPathList() {
        picPathList = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    @Override
    public String toString() {
        return "ExportResultInfo{" +
                "_ID=" + _ID +
                ", deviceName='" + deviceName + '\'' +
                ", devicePic='" + devicePic + '\'' +
                ", picPathList=" + picPathList +
                ", excelPath='" + excelPath + '\'' +
                '}';
    }

    public Long getParentId() {
        return this.parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public boolean getHadUploaded() {
        return this.hadUploaded;
    }

    public void setHadUploaded(boolean hadUploaded) {
        this.hadUploaded = hadUploaded;
    }

    public String getExportTime() {
        return exportTime;
    }

    public void setExportTime(String exportTime) {
        this.exportTime = exportTime;
    }

    public String getDeviceNum() {
        return deviceNum;
    }

    public void setDeviceNum(String deviceNum) {
        this.deviceNum = deviceNum;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 2098043190)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getExportResultInfoDao() : null;
    }
}